﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Infrastructure
{
    /// <summary>
    /// Interface to be used with numeric types that can be counted, like Discreet(int, long,short) or Continuous(double,float)
    /// </summary>
    public abstract class ICountable
    {
        /// <summary>
        /// returns numeric value of the rating.
        /// </summary>
        /// <returns></returns>
        public static implicit operator double(ICountable c)
        {
            return c.Value;
        }

        protected abstract double ToDouble();
        
        /// <summary>
        /// sets the value of the object.
        /// </summary>
        /// <param name="value"></param>
        public abstract double Value { get; set; }
     
        /// <summary>
        /// returns the possible minimal rating value
        /// </summary>
        /// <returns></returns>
        public abstract double MinValue { get; }
        /// <summary>
        /// returns the possible max value of rating
        /// </summary>
        /// <returns></returns>
        public abstract double MaxValue { get; }

    }

    /// <summary>
    /// Interface to be used with to calculate average to dataof different types
    /// 
    /// </summary>
    public interface IAvarageable
    {
        /// <summary>
        /// returns numeric value of average that was calculated based on the given data
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        double CalculateAverage(Object data);
    }
}
